#ifndef __NVM_PARAM_H
#define __NVM_PARAM_H

#include "config.h"
#include "eeprom_emulation_type_a.h"

typedef struct
{
    uint32_t header[2];      // 记录头
    uint16_t power_on_cycle; // 上电次数
    uint16_t frequency;      // 传输频率
    uint16_t threadhold[16]; // 数据区
    uint16_t max[16];     // 最大值
    uint16_t min[16];     // 最小值
} nvmparam_t;

typedef union
{
    uint8_t unformatted[EEPROM_EMULATION_RECORD_SIZE];
    nvmparam_t param;
} config_t;

extern volatile config_t config_buf;
extern uint32_t NVM_Param_Init(uint32_t *data);//注意，返回值0是成功
extern void NVM_Param_Read(uint32_t *data);
extern void NVM_Param_Write(uint32_t *data);

#endif // __NVM_PARAM_H